package cn.wzut.edut.service;

import cn.wzut.edut.dao.inf.*;
import cn.wzut.edut.dao.pojo.table.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 客户端服务层
 */
@Service
public class ClientService {

    @Autowired
    User login;

    @Autowired
    Menu menu;

    /**
     * 查询该用户是否有该菜单权限
     */
    public boolean selectRole(String user_id,String menu_id){
        List<SysMenu> menus = menu.selectSysMenus(login.selectSysUserOnlyRole(user_id));
        for (int i = 0;i<menus.size();i++){
            if(menus.get(i).getId().equals(menu_id)){
                return true;
            }
        }
        return false;
    }

}
